<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript" src="../js/vue.js"></script>
    <title>天气案例</title>
</head>
<body>
    <div id="root">
        <h2>今天天气很{{isHot}}</h2>
        <!-- 绑定事件时：@xxx=yyy yyy可以写一些简单的语句 -->
        <!-- <button @click="state = !state">切换天气</button> -->
        <button @click="changeWeather">切换天气</button>
    </div>
    <script type="text/javascript">
        new Vue({
            el:"#root",
            data(){
                return {
                    state: true
                }
            },
            methods:{
                changeWeather(){
                    this.state = !this.state
                }
            },
            computed:{
                isHot(){
                    return this.state?"炎热":"凉爽"
                }
            }
            
        })
    </script>
</body>
</html>